﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserList.aspx.cs" Inherits="WEALTH.Manager.User.UserList" %>

<%@ Register Src="../UserControl/cbxRole.ascx" TagName="cbxRole" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <link href="../css/admin.global.css" rel="stylesheet" type="text/css" />
    <link href="../css/admin.content.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="../js/jquery.utils.js"></script>
    <link href="../jBox/Skins/Green/jbox.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../jBox/jquery.jBox-2.3.min.js"></script>
    <script type="text/javascript" src="../js/admin.js"></script>
    <script type="text/javascript" src="../js/gridview_setting.js"></script>
    <script type="text/javascript">

        // 设置标题
        Index.SetTitle('用户列表');

        var issubmit;
        function setConfirm(btn) {
            if (issubmit) {
                return true;
            } else {
                var submit = function (v, h, f) {
                    if (v == 'ok') {
                        issubmit = true;
                        $(btn).click();
                    }
                }
                $.jBox.confirm("确定要更改用户状态吗?", "提示", submit);
                return false;
            }
        }

        // 清空所有检索条件
        function cleartext() {

            jQuery("#txtuserid").val("");
            jQuery("#txtusername").val("");
            jQuery("#txtEmail").val("");
            jQuery("#txtTel").val("");
            jQuery("#ddlStatus").get(0).selectedIndex = 0;

            //var arr = [];
            $("#cblRole_cblRole :checkbox:checked").each(function () {
                //arr.push($(this).next().html());
                if ($(this).attr('checked') == true) {
                    $(this).attr('checked', false);
                }
            })

            return true;
        }       
    </script>
</head>
<body>
    <div class="container">
        <form id="Form1" runat="server">
        <div class="location">
            当前位置：用户管理 -&gt; 用户列表</div>
        <div class="blank10">
        </div>
        <div class="search block">
            <div class="h">
                <span class="icon-sprite icon-magnifier"></span>
                <h3>
                    快速搜索</h3>
            </div>
            <div class="tl corner">
            </div>
            <div class="tr corner">
            </div>
            <div class="bl corner">
            </div>
            <div class="br corner">
            </div>
            <div class="cnt-wp">
                <div class="cnt">
                    <div class="search-bar">
                        <label class="first txt-green">
                            用户ID：</label>
                        <asp:TextBox ID="txtuserid" runat="server" CssClass="input-small"></asp:TextBox>
                        <label class="txt-green">
                            真实姓名：</label>
                        <asp:TextBox ID="txtusername" runat="server" CssClass="input-small"></asp:TextBox>
                        <label class="txt-green">
                            Email：</label>
                        <asp:TextBox ID="txtEmail" runat="server" CssClass="input-small"></asp:TextBox>
                        <label class="txt-green">
                            联系电话：</label>
                        <asp:TextBox ID="txtTel" runat="server" CssClass="input-small"></asp:TextBox>
                        <label class="txt-green">
                            用户状态：</label>
                        <asp:DropDownList ID="ddlStatus" runat="server">
                            <asp:ListItem Value="">不限</asp:ListItem>
                            <asp:ListItem Value="1">启用</asp:ListItem>
                            <asp:ListItem Value="0">禁用</asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    <div class="search-bar" style="padding-left: -3px;">
                        <table width="100%">
                            <tr>
                                <td style="width: 60px;">
                                    <label class="first txt-green">
                                        用户角色：</label>
                                </td>
                                <td>
                                    <uc1:cbxRole ID="cblRole" runat="server" />
                                </td>
                                <td align="right">
                                    <span class="btn-ctl-span">
                                        <asp:Button ID="btnSearch" runat="server" Text="搜索" OnClick="btnSearch_Click" /></span>
                                    <span class="btn-ctl-span">
                                        <input type="button" id="btnClear" onclick="cleartext();" value="清空" /></span>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="blank10">
        </div>
        <div class="block">
            <div class="h">
                <span class="icon-sprite icon-list"></span>
                <h3>
                    用户列表</h3>
                <div class="bar">
                    <a class="btn-lit" href="javascript:Index.Open('User/AddUser.aspx');"><span>新增</span></a>
                     <span class="btn-ctl-span"><asp:Button ID="btnSubmit" runat="server" Text="删除" onclick="btnSubmit_Click"/></span>
                </div>
            </div>
            <div class="tl corner">
            </div>
            <div class="tr corner">
            </div>
            <div class="bl corner">
            </div>
            <div class="br corner">
            </div>
            <div class="cnt-wp">
                <div class="cnt">
                    <asp:GridView ID="gvUser" runat="server" CssClass="data-table" border="0" CellPadding="0"
                        Width="100%" EnableTheming="True" AllowSorting="True" AutoGenerateColumns="False"
                        OnRowDataBound="gvUser_RowDataBound" AllowPaging="True" OnPageIndexChanging="gvUser_PageIndexChanging"
                        OnSorting="gvUser_Sorting" GridLines="None" OnDataBound="gvUser_DataBound">
                        <Columns>
                            
                            <asp:HyperLinkField DataNavigateUrlFields="USER_ID" DataTextField="USER_ID" HeaderText="ID"
                                NavigateUrl="../User/EditUser.aspx" DataNavigateUrlFormatString="~/User/EditUser.aspx?UserID={0}"
                                SortExpression="USER_ID" ItemStyle-CssClass="l" ItemStyle-Width="5%" />
                            <asp:BoundField DataField="USER_NAME" SortExpression="USER_NAME" ItemStyle-Width="10%"
                                ItemStyle-CssClass="l" HeaderText="姓名"  />
                            <asp:BoundField DataField="USER_PHONE" SortExpression="USER_PHONE" ItemStyle-Width="6%"
                                ItemStyle-CssClass="l" HeaderText="联系电话"  />
                            <asp:HyperLinkField DataNavigateUrlFields="USER_EMAIL" DataTextField="USER_EMAIL"
                                HeaderText="Email" ItemStyle-Width="10%" DataNavigateUrlFormatString="mailto:{0}"
                                SortExpression="USER_EMAIL" ItemStyle-CssClass="l" />
                            <asp:BoundField DataField="USER_CREATDATE" SortExpression="USER_CREATDATE" ItemStyle-Width="8%"
                                ItemStyle-CssClass="c" HeaderText="创建时间" ReadOnly="True" />
                            <asp:BoundField DataField="USER_STATUS" SortExpression="USER_STATUS" ItemStyle-Width="4%"
                                ItemStyle-CssClass="c" HeaderText="状态" ReadOnly="True" />
                            <asp:BoundField DataField="ROLE_NAME" SortExpression="ROLE_NAME" ItemStyle-Width="20%"
                                ItemStyle-CssClass="l" HeaderText="角色" ReadOnly="True" />
                            <asp:TemplateField ShowHeader="False" HeaderText="用户状态" ItemStyle-Width="5%" Visible="false">
                                <ItemTemplate>
                                    <span class="btn-ctl-span">
                                        <asp:Button ID="gvbtnStatus" runat="server" CausesValidation="False" CommandArgument='<%# Eval("USER_ID") %>'
                                            OnClientClick="return setConfirm(this);" OnClick="gvbtnStatus_Click" Text="按钮">
                                        </asp:Button></span>
                                </ItemTemplate>
                                <ItemStyle Width="5%"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="选择">
                                <ItemTemplate>
                                    <asp:CheckBox ID="chkdelete" runat="server" Checked="false" />
                                </ItemTemplate>
                                <ItemStyle Width="2%"></ItemStyle>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                </div>
                <script type="text/javascript">
                var pagerUrl = 'User/UserList.aspx?pageIndex={0}';
                Pager.Output(pagerUrl,<%=pageSize %>, <%=pageIndex %>, <%=pageCount %>, <%=recordCount %>); //(urlFormat, pageSize, pageIndex, pageCount, recordCount)
                </script>
            </div>
        </div>
        </form>
    </div>
</body>
</html>
